home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 1.iso
/
DEMON
/
UTILS
/
BASE64.ZIP
/
!base64
/
!Help
< prev
next >
Wrap
Text File
|
1994-11-14
|
6KB
|
122 lines
!base64
=======
version 0.03
!base64 is a simple utility which can be used to decode base64 encoded files
received as part of an email message. When run it will install an icon on
the icon bar.
!base64 does not make any attempt whatsoever to actually find the part, or
parts, of the email containing the base64 encoded file. That is up to you.
So before trying to decode the file you will need to load the message into
an editor, such as !Edit and select the base64 encoded part. Ensure that you
select all of it and *nothing more* than all of it. Failing to do this will
likely result in 'end of file' errors when !base64 attempts to decode the
file. In fact it doesn't matter if you select extra blank lines or spaces at
the start the encoded file, since the decoding process will ignore them.
Once you have selected the encoded part of your email you can, if you like,
save it to disc though this isn't really necessary since !base64 can accept
files saved to it directly from !Edit.
To decode your selection drag it onto the !base64 icon on the icon bar. A
dialogue box similar to a standard 'Save' box will open. Note that !base64
will only recognise 'text' files. Files with of any other type will be
ignored.
The save box contains a 'write' as text switch. You should turn this on if
you know that the encoded file is encoded text. If you it is encoded data,
an application or you're not sure what it is leave this switch off. There's
more info on this switch below.
Now to decode the file, enter a file name in the box and either drag the
file icon to a directory display. You can also drag it directly to an editor
such as !Edit if you wish. If all goes well, after a few seconds !base64
will have saved the decoded file. If you get 'end of file' errors then
either the file was badly encoded or you made your selection badly.
If the file was encoded text you may find that there are 'funny' characters
in it. This means that it uses a character set such as that from a PC or a
Mac. Try giving it to !Wombat and trying different types of character set
conversion.
If the file was encoded data then you may need to set the file-type before
you can use the decoded file.
Errors during decoding
----------------------
If 'end of file' is reached during decoding then an error is reported
telling you that the destination file may be corrupt. This is not
necessarily so -- you may simply have selected some blank lines beyond the
end of the encoded part of the email. However, the error may be caused by
your not having selected the entire encoding, by the file not being
correctly encoded or by it having being corrupted during transmission.
If errors other than 'end of file' are encountered during decoding then
decoding ceases immediately, the error is reported and the part of the
destination file created so far will be deleted if possible.
The 'Save as text' switch
-------------------------
One of the specifications for base64 encoding is that when encoding *text*
files all line-breaks in the source file are converted to CR-LF
(Return-Linefeed) before encoding. This is to ensure consistency between
different platforms.
If you leave the 'Save as text' switch off then any CRs in the decoded file
will be written to the destination file. You will then probably want to
remove them when the text is loaded into your editor. Turning the 'Save as
text' switch on means that you won't need to do this -- any decoded CRs will
simply be ignored, leaving you with just the LFs (which is the Archimedes
line feed convention).
If the encoded file contains data or an application then ensure that the
'Save as text' switch is off when decoding. This tells the decoder not to
ignore decoded CRs. The decoded file will then be exactly the same as the
original.
!base64 saves decoded files with file-type 'Text' if the switch is on and
with file-type 'Data' if the switch is off.
If you received the base64 encoding as part of a MIME message then the
'Content-Type' field in the header will indicate whether or not it is
encoded text. Note though that if the 'Content-Type' in the main message
header is 'Multipart' then each individual part will have its own
'Content-Type' header which will indicate what it contains. If the header
says 'Text/XXXX' then it is almost certainly OK to decode with the switch
on. If the 'Content-Type' is, for the whole message or a part, is missing
then the encoding contains plain text (that's the default).
Multipart emails will contain a 'Boundary' sub-field in the 'Content-type'
field of the main header. Each separate part of the message starts and ends
with this string (prefixed with '--'). You can use the boundary string to
search for the beginning and end of encoded parts if you wish. Note that
boundaries can be 'nested' though.
Eventually, this app may turn into a full blown MIME interpreter. Until that
happy day, it's better than nothing!
Limitations
===========
One obvious limitation is that the program does not search the message for
base64 encoded parts. I may get around to doing that one day. The real
answer to this is to ask folks not to send the messages in the first place.
!base64 can only decode 'base64' encoded messages, or those parts of
multipart messages which are encoded using base64. These are indicated by a
header field (either for the entire message or for any base64 encoded parts
in multipart messages) reading 'Content-Transfer-Encoding: Base64'.
!base64 cannot decode any other type of encoding, such as 'quoted-printable'.
--
Pete
====
14/11/94